package com.math.aistudykbr.mapper;

import com.math.aistudykbr.pojo.entity.MyMessage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AIMapper {
    @Delete("DELETE FROM message WHERE user_id = #{userId}")
    void deleteMessages(Long userId);

    @Insert("INSERT INTO message (msg, type, user_id) VALUES (#{messages}, #{type}, #{user})")
    void storeMessages(String messages, String type, Long user);

    @Select("SELECT * FROM message WHERE user_id = #{userId}")
    List<MyMessage> getHistoryMsg(Long userId);
}
